var apiTable = [
    {name: 'API_POST_LOGIN', env: 'development', api: 'http://119.147.37.168:9084/api/user/login'},
    {name: 'API_POST_LOGIN', env: 'production', api: 'http://119.147.37.168:9084/api/user/login'},

    {name: 'API_GET_USER_BY_TOKEN', env: 'development', api: 'http://119.147.37.168:9084/api/user/token/'},
    {name: 'API_GET_USER_BY_TOKEN', env: 'production', api: 'http://119.147.37.168:9084/api/user/token/'},

    {name: 'API_GET_LOGOUT', env: 'development', api: 'http://119.147.37.168:9084/api/user/logout/'},
    {name: 'API_GET_LOGOUT', env: 'production', api: 'http://119.147.37.168:9084/api/user/logout/'},

    {name: 'API_POST_CHANGE_PWD', env: 'development', api: 'http://119.147.37.168:9084/api/user/changepwd/'},
    {name: 'API_POST_CHANGE_PWD', env: 'production', api: 'http://119.147.37.168:9084/api/user/changepwd/'},

    {name: 'API_GET_USER_MENU', env: 'development', api: 'http://119.147.37.168:9084/api/user/menu/'},
    {name: 'API_GET_USER_MENU', env: 'production', api: 'http://119.147.37.168:9084/api/user/menu/'},

    {name: 'API_GET_USER_LIST', env: 'development', api: 'http://119.147.37.168:9082/api/user/list'},
    {name: 'API_GET_USER_LIST', env: 'production', api: 'http://119.147.37.168:9082/api/user/list'},

    {name: 'API_POST_USER_SAVE', env: 'development', api: 'http://119.147.37.168:9082/api/user/save'},
    {name: 'API_POST_USER_SAVE', env: 'production', api: 'http://119.147.37.168:9082/api/user/save'},

    {name: 'API_POST_USER_RESET_PWD', env: 'development', api: 'http://119.147.37.168:9082/api/user/resetpwd/'},
    {name: 'API_POST_USER_RESET_PWD', env: 'production', api: 'http://119.147.37.168:9082/api/user/resetpwd/'},

    {name: 'API_GET_ROLE_LIST', env: 'development', api: 'http://119.147.37.168:9082/api/role/list'},
    {name: 'API_GET_ROLE_LIST', env: 'production', api: 'http://119.147.37.168:9082/api/role/list'},

    {name: 'API_GET_USER_ROLE', env: 'development', api: 'http://119.147.37.168:9082/api/user/role/'},
    {name: 'API_GET_USER_ROLE', env: 'production', api: 'http://119.147.37.168:9082/api/user/role/'},

    {name: 'API_POST_USER_SET_ROLE', env: 'development', api: 'http://119.147.37.168:9082/api/user/setrole'},
    {name: 'API_POST_USER_SET_ROLE', env: 'production', api: 'http://119.147.37.168:9082/api/user/setrole'},

    {name: 'API_POST_ROLE_SAVE', env: 'development', api: 'http://119.147.37.168:9082/api/role/save'},
    {name: 'API_POST_ROLE_SAVE', env: 'production', api: 'http://119.147.37.168:9082/api/role/save'},

    {name: 'API_GET_MENU_TREE', env: 'development', api: 'http://119.147.37.168:9082/api/menu/tree'},
    {name: 'API_GET_MENU_TREE', env: 'production', api: 'http://119.147.37.168:9082/api/menu/tree'},

    {name: 'API_GET_RIGHT_LIST', env: 'development', api: 'http://119.147.37.168:9082/api/right/list'},
    {name: 'API_GET_RIGHT_LIST', env: 'production', api: 'http://119.147.37.168:9082/api/right/list'},

    {name: 'API_GET_ROLE_RIGHT', env: 'development', api: 'http://119.147.37.168:9082/api/role/right/'},
    {name: 'API_GET_ROLE_RIGHT', env: 'production', api: 'http://119.147.37.168:9082/api/role/right/'},

    {name: 'API_POST_ROLE_SET_RIGHT', env: 'development', api: 'http://119.147.37.168:9082/api/role/setright'},
    {name: 'API_POST_ROLE_SET_RIGHT', env: 'production', api: 'http://119.147.37.168:9082/api/role/setright'},

    {name: 'API_GET_LOG_LOGIN_LIST', env: 'development', api: 'http://119.147.37.168:9082/api/log/login/list'},
    {name: 'API_GET_LOG_LOGIN_LIST', env: 'production', api: 'http://119.147.37.168:9082/api/log/login/list'},

    {name: 'API_GET_LOG_OPERATION_LIST', env: 'development', api: 'http://119.147.37.168:9082/api/log/operation/list'},
    {name: 'API_GET_LOG_OPERATION_LIST', env: 'production', api: 'http://119.147.37.168:9082/api/log/operation/list'},

    {name: 'URL_LOGIN', env: 'development', api: 'http://localhost:8092'},
    {name: 'URL_LOGIN', env: 'production', api: 'http://119.147.37.168:9182'},

    {name: 'URL_INDEX', env: 'development', api: 'http://localhost:8091'},
    {name: 'URL_INDEX', env: 'production', api: 'http://119.147.37.168:9181'},

    {name: 'URL_INDEX_CMS', env: 'development', api: 'http://localhost:8093'},
    {name: 'URL_INDEX_CMS', env: 'production', api: 'http://119.147.37.168:9183'}
];

export const getAPI = function (name) {
    var api = '';
    apiTable.forEach(function(item, index) {
        if (item.name === name && item.env === process.env.NODE_ENV) {
            api = item.api;
        }
    });
    return api;
}
